Skip to content

fix(otlp): align trace metric attributes and aggregation - #9685

Merged
mabdinur merged 24 commits into
masterfrom
munir/otlp-trace-metrics-fixes
Aug 14, 2026
Merged

fix(otlp): align trace metric attributes and aggregation#9685
mabdinur merged 24 commits into
masterfrom
munir/otlp-trace-metrics-fixes

Conversation

@mabdinur

@mabdinur mabdinur commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Aligns traces.span.sdk.metrics.duration with the cross-tracer OTLP trace-metrics contract

  • Emits available SMC and datadog attributes regardless of DD_TRACE_OTEL_SEMANTICS_ENABLED
  • Translates existing aggregation fields for service, span name, span kind, status, HTTP, RPC, operation, type, origin, service source, trace root, and top-level state
  • Emits typed Datadog attributes and omits unknown or unset optional values
  • Adds runtime ID, process tags, and supported tracer tags to resource attributes
  • Separates aggregation groups when their exported attributes differ

Motivation

This implements the contract defined in DataDog/system-tests#7363 and refined in DataDog/system-tests#7466 without adding work to the native-stats path when OTLP export is disabled

Additional Notes

Service-boundary discovery is isolated in draft #9774. DD_TRACE_STATS_ADDITIONAL_TAGS and peer tags remain out of scope. Focused unit tests, npm run lint, the native-stats benchmark, and OTLP system tests pass

Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration)
attribute gaps found in a cross-tracer audit against SEMCON-1093:

- datadog.process_tags now emits one array-valued resource attribute
  (mirroring the legacy v0.6/stats ProcessTags shape) instead of
  flattening each tag into its own datadog.<key> attribute.
- datadog.is_trace_root is now emitted per data point, gated the same
  way as the other datadog.* attributes.
- span.kind is canonicalized to the OTel Span Metrics Connector's
  SPAN_KIND_* uppercase convention instead of being passed through
  lowercase.
- status.code is now a required string attribute
  (STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing
  the previous OTLP-trace-style int enum that was only set on errors.

additional_metric_tags and peer_tags remain unimplemented on this
path; both are flagged with a one-line TODO pointing at the
corresponding gap (or its absence) in the legacy v0.6/stats exporter.
@mabdinur mabdinur added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Aug 4, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 8.2 MB
Deduped: 8.86 MB
No deduping: 8.86 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 441.72 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-official

datadog-official Bot commented Aug 4, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 98.53% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a849759 | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.53%. Comparing base (77cd463) to head (a849759).
⚠️ Report is 45 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9685      +/-   ##
==========================================
- Coverage   98.55%   98.53%   -0.03%     
==========================================
  Files         966      975       +9     
  Lines      139420   144148    +4728     
  Branches    12543    13255     +712     
==========================================
+ Hits       137407   142031    +4624     
- Misses       2013     2117     +104     
Flag Coverage Δ
aiguard 57.23% <ø> (+0.22%) ⬆️
aiguard-integration 55.49% <ø> (-0.39%) ⬇️
apm-bucket-0 57.63% <ø> (+0.37%) ⬆️
apm-bucket-1 62.82% <ø> (-0.57%) ⬇️
apm-bucket-2 61.65% <ø> (-0.58%) ⬇️
apm-bucket-3 59.27% <ø> (-0.55%) ⬇️
apm-capabilities-tracing 62.35% <100.00%> (+0.03%) ⬆️
apm-integrations-aerospike 55.52% <ø> (-0.78%) ⬇️
apm-integrations-confluentinc-kafka-javascript 60.63% <ø> (-0.58%) ⬇️
apm-integrations-couchbase 56.21% <ø> (-0.52%) ⬇️
apm-integrations-http 61.38% <ø> (-0.54%) ⬇️
apm-integrations-kafkajs 61.15% <ø> (-0.59%) ⬇️
apm-integrations-next 58.89% <ø> (-0.54%) ⬇️
apm-integrations-prisma 58.33% <ø> (-0.20%) ⬇️
appsec 71.52% <ø> (-0.60%) ⬇️
appsec-express_fastify_graphql 68.91% <ø> (-0.53%) ⬇️
appsec-integration 49.60% <ø> (-0.58%) ⬇️
appsec-kafka_ldapjs_lodash 62.88% <ø> (-0.54%) ⬇️
appsec-mongodb-core_mongoose_mysql 66.37% <ø> (-0.52%) ⬇️
appsec-next 56.24% <ø> (-0.44%) ⬇️
appsec-node-serialize_passport_postgres 65.78% <ø> (-0.52%) ⬇️
appsec-sourcing_stripe_template 64.21% <ø> (-0.52%) ⬇️
debugger 63.67% <ø> (-0.59%) ⬇️
instrumentations-bucket-0 51.24% <ø> (-0.49%) ⬇️
instrumentations-bucket-1 59.13% <ø> (-0.29%) ⬇️
instrumentations-bucket-10 60.39% <ø> (-0.51%) ⬇️
instrumentations-bucket-11 61.05% <ø> (-0.58%) ⬇️
instrumentations-bucket-12 51.15% <ø> (-0.59%) ⬇️
instrumentations-bucket-13 52.00% <ø> (-0.47%) ⬇️
instrumentations-bucket-14 51.26% <ø> (-0.44%) ⬇️
instrumentations-bucket-2 52.49% <ø> (-0.69%) ⬇️
instrumentations-bucket-3 53.13% <ø> (-0.40%) ⬇️
instrumentations-bucket-4 58.21% <ø> (-0.57%) ⬇️
instrumentations-bucket-5 48.82% <ø> (-1.52%) ⬇️
instrumentations-bucket-6 59.74% <ø> (-0.79%) ⬇️
instrumentations-bucket-7 51.44% <ø> (-6.68%) ⬇️
instrumentations-bucket-8 57.92% <ø> (-1.19%) ⬇️
instrumentations-bucket-9 56.75% <ø> (-0.72%) ⬇️
instrumentations-instrumentation-couchbase 50.22% <ø> (-0.77%) ⬇️
instrumentations-integration-esbuild 33.87% <ø> (-0.37%) ⬇️
llmobs-ai_anthropic_bedrock 62.31% <ø> (-0.55%) ⬇️
llmobs-bucket-1 60.84% <ø> (-0.53%) ⬇️
llmobs-openai 61.25% <ø> (-0.52%) ⬇️
llmobs-openai-agents_vertex-ai 59.55% <ø> (-0.50%) ⬇️
llmobs-sdk 67.23% <ø> (+0.42%) ⬆️
master-coverage 98.53% <100.00%> (?)
openfeature 55.19% <ø> (-0.49%) ⬇️
openfeature-unit 52.84% <ø> (-0.42%) ⬇️
platform-core_esbuild_instrumentations-misc 40.85% <ø> (-0.43%) ⬇️
platform-integration 59.92% <ø> (-0.51%) ⬇️
platform-shimmer_unit-guardrails_webpack 38.49% <ø> (-0.45%) ⬇️
plugins-bucket-0 56.43% <ø> (-0.52%) ⬇️
plugins-bucket-1 53.55% <ø> (-0.48%) ⬇️
plugins-bucket-11 60.93% <ø> (-0.57%) ⬇️
plugins-bucket-17 60.75% <ø> (-0.56%) ⬇️
plugins-bucket-18 61.42% <ø> (-0.53%) ⬇️
plugins-bucket-19 60.78% <ø> (-0.56%) ⬇️
plugins-bucket-20 63.15% <ø> (-0.59%) ⬇️
plugins-bucket-4 57.81% <ø> (-0.52%) ⬇️
plugins-bullmq_cassandra_cookie 60.84% <ø> (-0.56%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 55.86% <ø> (-0.52%) ⬇️
plugins-fetch_fs_generic-pool 57.76% <ø> (-0.48%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 63.59% <ø> (-0.58%) ⬇️
plugins-hapi_hono_ioredis 59.38% <ø> (-0.54%) ⬇️
plugins-knex_langgraph_ldapjs 54.60% <ø> (-0.49%) ⬇️
plugins-light-my-request_limitd-client_lodash 57.85% <ø> (-0.54%) ⬇️
plugins-mariadb_memcached_mercurius 61.02% <ø> (-0.29%) ⬇️
plugins-mongodb_mongodb-core_mongoose 58.75% <ø> (-0.54%) ⬇️
plugins-multer_mysql_mysql2 58.34% <ø> (-0.54%) ⬇️
plugins-nats_node-serialize_opensearch 59.86% <ø> (-0.56%) ⬇️
plugins-passport-http_pino_postgres 58.08% <ø> (-0.53%) ⬇️
plugins-process_pug_redis 56.89% <ø> (-0.53%) ⬇️
plugins-undici_url_valkey 57.54% <ø> (-0.50%) ⬇️
plugins-vm_winston_ws 59.07% <ø> (-0.55%) ⬇️
profiling 61.16% <ø> (-0.37%) ⬇️
serverless-aws-sdk-aws-sdk 54.40% <ø> (-0.75%) ⬇️
serverless-aws-sdk-base-inject-field 50.47% <ø> (-0.50%) ⬇️
serverless-aws-sdk-bedrockruntime 54.19% <ø> (-0.50%) ⬇️
serverless-aws-sdk-client 55.71% <ø> (-0.54%) ⬇️
serverless-aws-sdk-dynamodb 55.02% <ø> (-0.50%) ⬇️
serverless-aws-sdk-eventbridge 56.49% <ø> (+6.73%) ⬆️
serverless-aws-sdk-kinesis 58.55% <ø> (-0.56%) ⬇️
serverless-aws-sdk-lambda 56.73% <ø> (-0.53%) ⬇️
serverless-aws-sdk-s3 55.11% <ø> (-0.51%) ⬇️
serverless-aws-sdk-serverless-peer-service 59.13% <ø> (-0.23%) ⬇️
serverless-aws-sdk-sns 59.34% <ø> (-0.57%) ⬇️
serverless-aws-sdk-sqs 59.75% <ø> (-0.58%) ⬇️
serverless-aws-sdk-stepfunctions 54.94% <ø> (-0.51%) ⬇️
serverless-aws-sdk-util 50.99% <ø> (-0.51%) ⬇️
serverless-bucket-0 53.35% <ø> (-0.73%) ⬇️
serverless-bucket-1 58.36% <ø> (-0.52%) ⬇️
test-optimization-cucumber 70.52% <ø> (-0.55%) ⬇️
test-optimization-cypress 64.76% <ø> (-0.03%) ⬇️
test-optimization-jest 71.98% <ø> (-0.46%) ⬇️
test-optimization-mocha 72.07% <ø> (-0.01%) ⬇️
test-optimization-playwright-playwright-atr 59.53% <ø> (-0.38%) ⬇️
test-optimization-playwright-playwright-efd 59.67% <ø> (-0.36%) ⬇️
test-optimization-playwright-playwright-final-status 59.83% <ø> (-0.37%) ⬇️
test-optimization-playwright-playwright-impacted-tests 59.39% <ø> (-0.20%) ⬇️
test-optimization-playwright-playwright-reporting 60.88% <ø> (-0.12%) ⬇️
test-optimization-playwright-playwright-test-management 60.32% <ø> (-0.64%) ⬇️
test-optimization-playwright-playwright-test-span 59.57% <ø> (-0.37%) ⬇️
test-optimization-selenium 58.77% <ø> (-0.47%) ⬇️
test-optimization-testopt 57.44% <ø> (-0.11%) ⬇️
test-optimization-vitest 72.70% <ø> (-0.60%) ⬇️
test-optimization-vitest-browser 58.62% <ø> (-0.30%) ⬇️
test-optimization-webdriverio 64.91% <ø> (-0.51%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

service.name was omitted from OTLP trace-metrics data points whenever
a span's service matched the default/global service, mirroring the
status.code fix earlier in this branch: required attributes must be
unconditional, not skipped as an optimization.
@pr-commenter

pr-commenter Bot commented Aug 4, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-14 14:03:45

Comparing candidate commit a849759 in PR branch munir/otlp-trace-metrics-fixes with baseline commit 77cd463 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2320 metrics, 38 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-204542.040µs; +204668.606µs] or [-7.562%; +7.566%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-230.350ms; +233.865ms] or [-8.902%; +9.038%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-197.971ms; +189.120ms] or [-6.734%; +6.433%]

scenario:appsec-control-20

  • unstable execution_time [-114.412ms; +132.064ms] or [-6.953%; +8.026%]

scenario:appsec-control-24

  • unstable execution_time [-114.663ms; +116.894ms] or [-9.125%; +9.303%]

scenario:appsec-control-26

  • unstable execution_time [-125.363ms; +127.489ms] or [-10.015%; +10.184%]

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-10.576ms; +18.149ms] or [-4.199%; +7.205%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-24.822ms; +30.806ms] or [-4.552%; +5.649%]

scenario:debugger-line-probe-with-snapshot-default-24

  • unstable cpu_user_time [-2422.048ms; +3057.044ms] or [-26.812%; +33.842%]
  • unstable execution_time [-2415.251ms; +3066.009ms] or [-24.764%; +31.436%]
  • unstable instructions [-20.7G instructions; +26.2G instructions] or [-28.099%; +35.561%]
  • unstable max_rss_usage [-8.508MB; +11.376MB] or [-5.261%; +7.035%]
  • unstable throughput [-885.130op/s; +679.925op/s] or [-25.679%; +19.726%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-2321.594ms; +732.744ms] or [-24.257%; +7.656%]
  • unstable execution_time [-2339.264ms; +730.949ms] or [-22.684%; +7.088%]
  • unstable instructions [-20.7G instructions; +6.6G instructions] or [-25.954%; +8.342%]
  • unstable throughput [-141.216op/s; +461.293op/s] or [-4.393%; +14.348%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable cpu_user_time [-1680.984ms; +2930.537ms] or [-20.443%; +35.639%]
  • unstable execution_time [-1824.630ms; +3103.230ms] or [-20.385%; +34.670%]
  • unstable instructions [-14.3G instructions; +25.0G instructions] or [-21.300%; +37.414%]
  • unstable max_rss_usage [-6.898MB; +10.523MB] or [-4.345%; +6.628%]
  • unstable throughput [-877.019op/s; +500.987op/s] or [-23.819%; +13.606%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable cpu_user_time [-2776.315ms; +2811.241ms] or [-31.117%; +31.509%]
  • unstable execution_time [-2795.875ms; +2855.953ms] or [-29.007%; +29.631%]
  • unstable instructions [-23723.4M instructions; +24153.4M instructions] or [-32.562%; +33.153%]
  • unstable max_rss_usage [-9746.204KB; +11472.604KB] or [-6.095%; +7.174%]
  • unstable throughput [-763.778op/s; +747.857op/s] or [-21.893%; +21.437%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-2662.945ms; +4213.037ms] or [-27.936%; +44.197%]
  • unstable execution_time [-2711.796ms; +4272.231ms] or [-26.476%; +41.711%]
  • unstable instructions [-23.6G instructions; +37.4G instructions] or [-29.631%; +46.975%]
  • unstable max_rss_usage [-9.693MB; +14.549MB] or [-6.162%; +9.249%]
  • unstable throughput [-833.006op/s; +533.505op/s] or [-25.695%; +16.457%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-281.720ms; +367.633ms] or [-5.736%; +7.486%]
  • unstable execution_time [-281.350ms; +365.871ms] or [-5.647%; +7.343%]
  • unstable throughput [-131447.523op/s; +96656.288op/s] or [-7.800%; +5.735%]

scenario:id-generate-20

  • unstable execution_time [-99.516ms; +165.338ms] or [-4.053%; +6.734%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-29.011MB; +38.039MB] or [-15.694%; +20.578%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-5231.035KB; +5676.702KB] or [-6.478%; +7.029%]

@mabdinur
mabdinur marked this pull request as ready for review August 5, 2026 20:14
@mabdinur
mabdinur requested a review from a team as a code owner August 5, 2026 20:14
@mabdinur
mabdinur requested review from BridgeAR and removed request for a team August 5, 2026 20:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9775eee23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/dd-trace/src/span_stats.js Outdated
Comment thread packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85f040093a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/dd-trace/src/span_stats.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3065873246

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8e8c00fe3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/dd-trace/src/span_processor.js Outdated
Comment thread packages/dd-trace/src/span_processor.js Outdated
Comment thread packages/dd-trace/src/opentelemetry/metrics/index.js Outdated
@mabdinur
mabdinur requested a review from a team as a code owner August 10, 2026 20:57
@mabdinur

Copy link
Copy Markdown
Contributor Author

Benchmarks

Benchmark execution time: 2026-08-10 21:09:30

Comparing candidate commit 6cc12c5 in PR branch munir/otlp-trace-metrics-fixes with baseline commit b5b4867 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 12 performance regressions! Performance is the same for 2313 metrics, 33 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:exporting-pipeline-format-with-stats-20

  • 🟥 cpu_user_time [+64.777ms; +166.743ms] or [+3.051%; +7.853%]
  • 🟥 execution_time [+67.011ms; +169.844ms] or [+3.121%; +7.911%]
  • 🟥 instructions [+498.4M instructions; +1006.8M instructions] or [+2.076%; +4.192%]
  • 🟥 throughput [-7326.402op/s; -3023.202op/s] or [-7.808%; -3.222%]

scenario:exporting-pipeline-format-with-stats-24

  • 🟥 cpu_user_time [+75.471ms; +177.556ms] or [+3.955%; +9.306%]
  • 🟥 execution_time [+75.352ms; +175.693ms] or [+3.901%; +9.097%]
  • 🟥 instructions [+565.5M instructions; +1096.8M instructions] or [+2.580%; +5.003%]
  • 🟥 throughput [-9497.182op/s; -4186.273op/s] or [-9.041%; -3.985%]

scenario:exporting-pipeline-format-with-stats-26

  • 🟥 cpu_user_time [+88.710ms; +191.637ms] or [+4.586%; +9.908%]
  • 🟥 execution_time [+88.411ms; +197.303ms] or [+4.489%; +10.018%]
  • 🟥 instructions [+555.4M instructions; +1073.7M instructions] or [+2.481%; +4.795%]
  • 🟥 throughput [-10298.350op/s; -4782.553op/s] or [-10.027%; -4.657%]

Unstable benchmarks

Reverting the change that introduced this overhead. It was introduced by a bug fix for the existing stats where to ensure metrics for spans with local/integration level service names were not combined the metrics for spans with the global service name. This fix can be moved out to it's own PR and optimized separately.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2931d99061

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/dd-trace/src/span_processor.js Outdated
Native stats without OTLP regressed from a 1.26s to 1.43s benchmark median because service-boundary state was tracked for every span. Removing that tracking restores the master baseline; the behavior will move to an OTLP-gated follow-up.

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a brief look and can not yet determine full correctness

Comment thread packages/dd-trace/src/opentelemetry/metrics/index.js Outdated
Comment thread packages/dd-trace/src/opentelemetry/metrics/index.js Outdated
Comment thread packages/dd-trace/src/opentelemetry/metrics/index.js Outdated
Comment thread packages/dd-trace/src/opentelemetry/metrics/index.js Outdated
Comment thread packages/dd-trace/src/span_stats.js Outdated
@mabdinur
mabdinur requested a review from BridgeAR August 12, 2026 14:52

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know the domain, so it is hard to say it works as expected without that.

Code wise, I have one performance suggestion which should reduce the overhead quite a bit :)

Serialize base attributes once per aggregation group and append the top-level and status dimensions for each distribution key.

Key-generation microbenchmark, two fresh runs with five-trial medians: 570.6ms to 126.9ms and 569.9ms to 127.3ms.
@mabdinur
mabdinur requested a review from BridgeAR August 13, 2026 17:11
Comment on lines +156 to +160
const attributes = {
...baseAttributes,
'datadog.span.top_level': topLevel,
'status.code': statusCode,
}

@BridgeAR BridgeAR Aug 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These attributes are only needed for the later transform call which actually just reads the values, maps over them, builds an array with objects and builds special values. We already know the type for statusCode and topLevel, so we know the value shape and we can already calculate the array immediately. That would be even less work and we do not copy any objects here and need less iterations.

Kind of

const transformedAttributes = this.transformAttributes(attributes)
transformedAttributes.push(
  { key: 'datadog.span.top_level', value: { boolValue: topLevel } },
  { key: 'status.code', value: { intValue: statusCode }
)

Build the known top-level and status OTLP values directly instead of copying and re-transforming the base attributes.
@mabdinur
mabdinur requested a review from BridgeAR August 14, 2026 05:08
@mabdinur

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 14, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-14 13:44:07 UTC ℹ️ Start processing command /merge


2026-08-14 13:44:17 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-08-14 14:09:22 UTC ℹ️ MergeQueue: This merge request was already merged

This pull request was merged directly.

@mabdinur
mabdinur force-pushed the munir/otlp-trace-metrics-fixes branch from ddb64b7 to 5069eb6 Compare August 14, 2026 13:50
@mabdinur
mabdinur enabled auto-merge (squash) August 14, 2026 13:51
@mabdinur
mabdinur force-pushed the munir/otlp-trace-metrics-fixes branch from 5069eb6 to a849759 Compare August 14, 2026 13:52
@mabdinur
mabdinur merged commit 942f9f8 into master Aug 14, 2026
721 of 722 checks passed
@mabdinur
mabdinur deleted the munir/otlp-trace-metrics-fixes branch August 14, 2026 14:09
dd-octo-sts Bot pushed a commit that referenced this pull request Aug 17, 2026
* fix(otlp): align trace-metrics attributes with the RFC attribute spec

Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration)
attribute gaps found in a cross-tracer audit against SEMCON-1093:

- datadog.process_tags now emits one array-valued resource attribute
  (mirroring the legacy v0.6/stats ProcessTags shape) instead of
  flattening each tag into its own datadog.<key> attribute.
- datadog.is_trace_root is now emitted per data point, gated the same
  way as the other datadog.* attributes.
- span.kind is canonicalized to the OTel Span Metrics Connector's
  SPAN_KIND_* uppercase convention instead of being passed through
  lowercase.
- status.code is now a required string attribute
  (STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing
  the previous OTLP-trace-style int enum that was only set on errors.

additional_metric_tags and peer_tags remain unimplemented on this
path; both are flagged with a one-line TODO pointing at the
corresponding gap (or its absence) in the legacy v0.6/stats exporter.

* fix(otlp): always emit service.name on trace-metrics data points

service.name was omitted from OTLP trace-metrics data points whenever
a span's service matched the default/global service, mirroring the
status.code fix earlier in this branch: required attributes must be
unconditional, not skipped as an optimization.

* fix(otlp): coalesce trace metrics by exported attributes

* fix(otlp): finalize trace metrics semantics

* fix(otlp): retain semantic attributes in OTel mode

* fix(otlp): defer trace-root attribute detection

* test(otlp): reserve only datadog attributes

* fix(otlp): omit unknown trace-root attribute

* fix(otlp): always emit trace metric attributes

* fix(otlp): guard span kind mapping

* test(otlp): cover unspecified span kind fallback

* fix(otlp): include service-entry metrics and tracer tags

* fix(otlp): harden tracer tags and service-entry tracking

* fix(otlp): retain services across partial flushes

* fix(otlp): weakly retain cached span services

* perf(otlp): reduce trace metric processing overhead

* perf(otlp): remove service tracking from stats hot path

Native stats without OTLP regressed from a 1.26s to 1.43s benchmark median because service-boundary state was tracked for every span. Removing that tracking restores the master baseline; the behavior will move to an OTLP-gated follow-up.

* chore(otlp): keep span processor out of core changes

* refactor(otlp): rely on initialized resource inputs

* refactor(stats): pass trace-root flag directly

* perf(otlp): reuse span metric attribute key

Serialize base attributes once per aggregation group and append the top-level and status dimensions for each distribution key.

Key-generation microbenchmark, two fresh runs with five-trial medians: 570.6ms to 126.9ms and 569.9ms to 127.3ms.

* perf(otlp): avoid redundant attribute transforms

Build the known top-level and status OTLP values directly instead of copying and re-transforming the base attributes.
dd-octo-sts Bot pushed a commit that referenced this pull request Aug 17, 2026
* fix(otlp): align trace-metrics attributes with the RFC attribute spec

Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration)
attribute gaps found in a cross-tracer audit against SEMCON-1093:

- datadog.process_tags now emits one array-valued resource attribute
  (mirroring the legacy v0.6/stats ProcessTags shape) instead of
  flattening each tag into its own datadog.<key> attribute.
- datadog.is_trace_root is now emitted per data point, gated the same
  way as the other datadog.* attributes.
- span.kind is canonicalized to the OTel Span Metrics Connector's
  SPAN_KIND_* uppercase convention instead of being passed through
  lowercase.
- status.code is now a required string attribute
  (STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing
  the previous OTLP-trace-style int enum that was only set on errors.

additional_metric_tags and peer_tags remain unimplemented on this
path; both are flagged with a one-line TODO pointing at the
corresponding gap (or its absence) in the legacy v0.6/stats exporter.

* fix(otlp): always emit service.name on trace-metrics data points

service.name was omitted from OTLP trace-metrics data points whenever
a span's service matched the default/global service, mirroring the
status.code fix earlier in this branch: required attributes must be
unconditional, not skipped as an optimization.

* fix(otlp): coalesce trace metrics by exported attributes

* fix(otlp): finalize trace metrics semantics

* fix(otlp): retain semantic attributes in OTel mode

* fix(otlp): defer trace-root attribute detection

* test(otlp): reserve only datadog attributes

* fix(otlp): omit unknown trace-root attribute

* fix(otlp): always emit trace metric attributes

* fix(otlp): guard span kind mapping

* test(otlp): cover unspecified span kind fallback

* fix(otlp): include service-entry metrics and tracer tags

* fix(otlp): harden tracer tags and service-entry tracking

* fix(otlp): retain services across partial flushes

* fix(otlp): weakly retain cached span services

* perf(otlp): reduce trace metric processing overhead

* perf(otlp): remove service tracking from stats hot path

Native stats without OTLP regressed from a 1.26s to 1.43s benchmark median because service-boundary state was tracked for every span. Removing that tracking restores the master baseline; the behavior will move to an OTLP-gated follow-up.

* chore(otlp): keep span processor out of core changes

* refactor(otlp): rely on initialized resource inputs

* refactor(stats): pass trace-root flag directly

* perf(otlp): reuse span metric attribute key

Serialize base attributes once per aggregation group and append the top-level and status dimensions for each distribution key.

Key-generation microbenchmark, two fresh runs with five-trial medians: 570.6ms to 126.9ms and 569.9ms to 127.3ms.

* perf(otlp): avoid redundant attribute transforms

Build the known top-level and status OTLP values directly instead of copying and re-transforming the base attributes.
This was referenced Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos semver-patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants